package com.api.user.controller;
import com.api.core.controller.Ctrl;
import com.api.core.response.Result;
import com.api.core.response.ResultGenerator;
import com.api.user.model.Fqa;
import com.api.user.service.FqaService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tk.mybatis.mapper.entity.Condition;
import tk.mybatis.mapper.entity.Example;
import javax.annotation.Resource;
import java.util.List;
import com.api.core.annotation.PowerEnable;
import io.swagger.annotations.*;



/**
* Created by wanghuiwen on 2021/04/20.
*/
@PowerEnable(name = "帮助中心",url = "/fqa")
@Api(value = "帮助中心", tags = {"帮助中心"})
@RestController
@RequestMapping("/fqa")
public class FqaController extends Ctrl{
    @Resource
    private FqaService fqaService;

    @ApiOperation(value = "FQA添加", tags = {"帮助中心"}, notes = "FQA添加")
    @PostMapping(value="/add",name="FQA添加")
    public Result add(@ApiParam Fqa fqa) {

        return fqaService.add(fqa);
    }

    @PostMapping(value="/delete",name="FQA删除")
    public Result delete(@RequestParam Long id) {
        fqaService.deleteById(id);

        return ResultGenerator.genSuccessResult();
    }

    @PostMapping(value="/update",name="FQA修改")
    public Result update(@ApiParam Fqa fqa) {
        fqaService.update(fqa);
        return ResultGenerator.genSuccessResult();
    }




    @ApiOperation(value = "FQA列表", tags = {"帮助中心"}, notes = "FQA列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "type",required=false, value = "类型", dataType = "Long", paramType = "query")
    })
    @PostMapping(value = "/list", name = "FQA列表")
    public Result list(Integer type) {
        return fqaService.list(type);
    }

}
